package cn.cjxy.javaweb.servlet.session;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * session中的方法	说明
 * int getMaxInactiveInterval()	得到服务器上会话最大的非活动时间间隔，默认是1800秒(30分钟)
 * @author huangjie
 * @date 2025/9/29
 */
@WebServlet("/setsession")
public class SetServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //往session中存值
        req.getSession().setAttribute("user","lisi");
        resp.getWriter().println("ok!");
    }
}
